﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace ExpressionUtil.Node.Common
{
    /// <summary>
    /// 抽象的表达式节点
    /// </summary>
    [Serializable]
    internal abstract class Node
    {
        /// <summary>
        /// 执行节点运算
        /// </summary>
        /// <param name="context">执行参数</param>
        /// <returns>执行结果的类型</returns>
        public abstract ExecuteRunTimeType Execute(ExecuteContext context);

#if DEBUG
        /// <summary>
        /// Dump节点
        /// </summary>
        public void DumpNode()
        {
            Debug.IndentLevel += 1;
            this.DumpCore();
            Debug.IndentLevel -= 1;
        }

        /// <summary>
        /// Dump节点的核心工作
        /// </summary>
        protected abstract void DumpCore();
#endif
    }
}
